package services

/*
//1	equipmentTime
//8	temperature
//9	humidity
//10	collectedCurrent1
//11	collectedCurrent2
//12	noLoadCurrent
//13	idleCurrent
//14	fullLoadCurrent
//15	hardwareVersion
//16	controllerStatus
//17	faultAlarm
//18	internalRegister2
//19	internalRegister3
//20	internalRegister4
*/
// 设备上报数据规则
var DeviceUpDataMap = map[string]DataRule{
	"equipmentTime":     {StartAddr: 1, Length: 7},
	"temperature":       {StartAddr: 8, Length: 1},
	"humidity":          {StartAddr: 9, Length: 1},
	"collectedCurrent1": {StartAddr: 10, Length: 1},
	"collectedCurrent2": {StartAddr: 11, Length: 1},
	"noLoadCurrent":     {StartAddr: 12, Length: 1},
	"idleCurrent":       {StartAddr: 13, Length: 1},
	"fullLoadCurrent":   {StartAddr: 14, Length: 1},
	"hardwareVersion":   {StartAddr: 15, Length: 1},
	"controllerStatus":  {StartAddr: 16, Length: 1},
	"faultAlarm":        {StartAddr: 17, Length: 1},
	"internalRegister2": {StartAddr: 18, Length: 1},
	"internalRegister3": {StartAddr: 19, Length: 1},
	"internalRegister4": {StartAddr: 20, Length: 1},
}

// 遥测数据
type DeviceDataTelemetry struct {
	Temperature uint8 `json:"temperature"`
	Humidity    uint8 `json:"humidity"`
}

// 属性数据
type DeviceDataAttribute struct {
	EquipmentTime     string `json:"equipmentTime"`
	CollectedCurrent1 uint8  `json:"collectedCurrent1"`
	CollectedCurrent2 uint8  `json:"collectedCurrent2"`
	NoLoadCurrent     uint8  `json:"noLoadCurrent"`
	IdleCurrent       uint8  `json:"idleCurrent"`
	FullLoadCurrent   uint8  `json:"fullLoadCurrent"`
	HardwareVersion   uint8  `json:"hardwareVersion"`
	ControllerStatus  uint8  `json:"controllerStatus"`
	FaultAlarm        uint8  `json:"faultAlarm"`
	InternalRegister2 uint8  `json:"internalRegister2"`
	InternalRegister3 uint8  `json:"internalRegister3"`
	InternalRegister4 uint8  `json:"internalRegister4"`
}
